package org.example.auth.controller;


import org.example.auth.dto.LoginDTO;
import org.example.auth.query.EmployeeRoleQuery;
import org.example.auth.service.IEmployeeRoleService;
import org.example.auth.service.ILoginService;
import org.example.auth.vo.LoginVO;
import org.example.base.util.AjaxResult;
import org.example.base.util.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    public ILoginService service;

    @PutMapping
    public AjaxResult addOrUpdate(@RequestBody LoginDTO loginDTO){
        try {

            LoginVO loginVO=service.login(loginDTO);
            return AjaxResult.success();
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.error("登录失败！"+e.getMessage());
        }
    }
}
